package edu.jmu.service.user.impl;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import edu.jmu.bean.user.User;
import edu.jmu.service.base.DaoSupport;
import edu.jmu.service.user.UserService;
/**
 * 用户业务类 
 * @author Neal
 *
 */
@Service
public class UserServiceBean extends DaoSupport<User> implements UserService{

	@Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
	public boolean checkUser(User user) {
		String jpql = "select count(o) from User o where o.userName = ?1 and o.passWord = ?2";
		Long count = (Long) em.createQuery(jpql).setParameter(1, user.getUserName()).setParameter(2, user.getPassWord())
				.getSingleResult();		
		return count>0;
	}

}
